package com.ruoyi.secondvitim.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.secondvitim.domain.VitimNursingExperts;
import com.ruoyi.secondvitim.service.IVitimNursingExpertsService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 护理专家团队介绍Controller
 * 
 * @author alonso_ecit
 * @date 2025-11-14
 */
@RestController
@RequestMapping("/secondVitim/nursingExperts")
public class VitimNursingExpertsController extends BaseController
{
    @Autowired
    private IVitimNursingExpertsService vitimNursingExpertsService;

    /**
     * 查询护理专家团队介绍列表
     */
    @PreAuthorize("@ss.hasPermi('secondVitim:nursingExperts:list')")
    @GetMapping("/list")
    public TableDataInfo list(VitimNursingExperts vitimNursingExperts)
    {
        startPage();
        List<VitimNursingExperts> list = vitimNursingExpertsService.selectVitimNursingExpertsList(vitimNursingExperts);
        return getDataTable(list);
    }

    /**
     * 导出护理专家团队介绍列表
     */
    @PreAuthorize("@ss.hasPermi('secondVitim:nursingExperts:export')")
    @Log(title = "护理专家团队介绍", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, VitimNursingExperts vitimNursingExperts)
    {
        List<VitimNursingExperts> list = vitimNursingExpertsService.selectVitimNursingExpertsList(vitimNursingExperts);
        ExcelUtil<VitimNursingExperts> util = new ExcelUtil<VitimNursingExperts>(VitimNursingExperts.class);
        util.exportExcel(response, list, "护理专家团队介绍数据");
    }

    /**
     * 获取护理专家团队介绍详细信息
     */
    @PreAuthorize("@ss.hasPermi('secondVitim:nursingExperts:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(vitimNursingExpertsService.selectVitimNursingExpertsById(id));
    }

    /**
     * 新增护理专家团队介绍
     */
    @PreAuthorize("@ss.hasPermi('secondVitim:nursingExperts:add')")
    @Log(title = "护理专家团队介绍", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody VitimNursingExperts vitimNursingExperts)
    {
        return toAjax(vitimNursingExpertsService.insertVitimNursingExperts(vitimNursingExperts));
    }

    /**
     * 修改护理专家团队介绍
     */
    @PreAuthorize("@ss.hasPermi('secondVitim:nursingExperts:edit')")
    @Log(title = "护理专家团队介绍", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody VitimNursingExperts vitimNursingExperts)
    {
        return toAjax(vitimNursingExpertsService.updateVitimNursingExperts(vitimNursingExperts));
    }

    /**
     * 删除护理专家团队介绍
     */
    @PreAuthorize("@ss.hasPermi('secondVitim:nursingExperts:remove')")
    @Log(title = "护理专家团队介绍", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(vitimNursingExpertsService.deleteVitimNursingExpertsByIds(ids));
    }
}
